import java.text.DecimalFormat;

public class Commission {
	public static String classify(int lock, int stock, int barrel) {	
		int Plock = 45;
		int Pstock = 35;
		int Pbarrel = 25;
		int Slock = 0, Sstock = 0, Sbarrel = 0;
		int lockSales = 0, stockSales = 0, barrelSales=0;
		double commission = 0.00;
		DecimalFormat df = new DecimalFormat("######0.00"); 
		while( lock <= 70 && lock >=0 && stock <= 80 && stock >= 0 && barrel <= 90 && barrel >= 0){
			Slock = Slock + lock;
			Sstock = Sstock + stock;
			Sbarrel = Sbarrel + barrel;
			lockSales = Plock * Slock;
			stockSales = Pstock * Sstock;
			barrelSales = Pbarrel * Sbarrel;
			int sales = lockSales + stockSales + barrelSales;			
			if(sales > 1800){
				commission = 0.1 * 1000;
				commission = commission + 0.15 * 800;
				commission = commission + 0.2 * (sales - 1800); 
			}else if(sales > 1000){
				commission = 0.1 * 1000;
				commission = commission + 0.15 * (sales - 1000); 
			}else{
				commission = 0.1 * sales;
			}
			return df.format(commission);
		}
		while(lock >70 || stock > 80 || barrel > 90){
			return "超出预售范围";
		}
		while(lock < 0 || stock < 0 || barrel < 0){
			return "输入不合法";
		}
		return df.format(commission);
  }
}
